Set tasks and timers duration
Tasks duration is used to calculate performance indicators and the status of pending activities in the Work Portal.
Duration can be static, defined in the Process Model or it can be dynamic, evaluated by an expression when the Task is created.
IMPORTANT
- Dynamic duration has to be defined in minutes or it must return a fixed date.
- Durations MUST be set On Enter of Activities to be taken into consideration. If the duration is not set On Enter, then Bizagi will use the static duration defined in the Process Model.
Topics:
- Set Task duration - defining duration in time
- Set Task duration - with a fixed date
- Set Timer duration
- Set duration of Timers attached to activities
- Set Timer duration considering the Working time schema and timezone of a user
Set Task duration - defining duration in time
Suppose you have a Travel Request process where the Administrative Department of your company locates and registers the travel bookings on your behalf. You can request a national or an international trip, and based on this locality, the booking administrator will have two or three days respectively to book the hotel and flight.
Since the duration of the task is not static, we need an expression to set it.
National and international destinations are stored in a Parameter Entity, and are distinguished by a Code: "1" for national and "2" for international.
Steps:
-
In the fourth step of the Bizagi Process Wizard (Business Rules), select Activity Actions.
Click the Task in which the duration will be calculated and create an On Enter Expression.
-
Create the expression to set the duration.
We recommend using vocabularies to store constant duration for Tasks, allowing for easy modification in the Work Portal if the business condition should change.
In order to use vocabularies, they must be created before the referencing expression.
We will use two previously defined constant vocabularies. These can be modified at any time by end users in the Work Portal, responding to changing business needs.
-
Determine if the request is national or international.
Set the duration to the element in the vocabulary. This is done by using the Task Duration function available in the Function list of the Date & Time category.
Set Task duration - defining duration with a fixed date
Suppose you have a Travel Request process where the Administrative Department of your company locates and registers the travel bookings on your behalf. Based on the locality type of a request (i.e., a national or an international trip), the booking administrator will have up to one day before departure (Leaving Date) to book the hotel and flight.
Steps:
-
In the fourth step of the Bizagi Process Wizard (Business Rules), select Activity Actions.
Click the Task in which the duration will be calculated and create an On Enter Expression.
-
Declare the necessary variables.
In this example, we need two variables of the date-time type:
- LeavingDate: Stores the value of the Leaving Date attribute
- FixedDate: Stores the derived due date and will be used to set the Task Duration
-
Create the expression to set the duration.
First, retrieve the leaving date from the attribute Leaving Date by navigating the Data Model. The value will be set to the previously declared variable.
The Task duration will be set to one day before the LeavingDate.
-
To set the duration to the Task, use the function Case estimated solution date found in the Date & Time Category.
Set Timers duration
In the Travel Request process, suppose that once the booking flight due date has lapsed (one day before the trip), the booking administrator's supervisor must search for last-minute flight offers.
You can use an Event-based Gateway to evaluate if the Bookings Task has been reached before the booking due date. If the due date is reached first, the Bookings Task will be disabled and the Perform Last minute actions Task will be enabled for the supervisor.
Steps:
-
In the fourth step of the Bizagi Process Wizard (Business Rules), select Activity Actions.
Click on the Timer Event in which the duration will be calculated and create an On Enter Expression.
-
Declare the following variables:
- LeavingDate: Stores the value of the Leaving Date attribute.
- FixedDate: Stores the derived due date and will be used to set the Timer Duration.
-
Create the expression to set the duration.
The Timer duration will be set to one day before the LeavingDate.
-
To set the duration to the Timer Event, use the function Case estimated solution date in the Date & Time Category.
Set duration to Timers attached to activities
If the bookings are not finalized after three days, an exception flow is activated, and the Perform Last Minute Actions Task is enabled for the booking administrator's supervisor. We need to define the timer's duration to properly model this business situation.
Steps:
-
In the fourth step of the Bizagi Process Wizard (Business Rules), select Activity Actions.
Click on the Timer Event in which the duration will be calculated and create an On Enter Expression.
-
Create the expression to set the duration.
We recommend using vocabularies to store constant duration for Tasks, allowing for easy modification in the Work Portal.
-
To set the duration for the Timer, use the function Timer Event Duration.
Set timer duration considering the Working time schema and the user's timezone
The Agility Corp manages customer claims and complaints using Bizagi. The company has established that a customer service agent can spend a maximum of 4 hours responding to a claim or complaint.
Steps:
-
In the fourth step of the Bizagi Process Wizard (Business Rules), select Activity Actions.
Click on the task for which the duration will be set and create an On Enter Expression.
-
Create an expression.
First, we must obtain the agent's id using the function User id of the current user.
-
To set the duration to the task, use the function Case estimated solution date in the Date & Time Category.
-
Use the function Calculate a date considering the time schema and user timezone.